package cn.com.generaldata.os.service.indicator_evaluation.composition_analysis;

import org.apache.commons.lang3.Validate;

import cn.com.generaldata.jsme_indicator_system.entity.IndicatorEvaluation;
import cn.com.generaldata.os.service.indicator_constant.ProvinceIndicatorConstant;
import cn.com.generaldata.os.service.indicator_evaluation.IndicatorEvaluationCalculateService;
import cn.com.generaldata.os.vo.IndicatorAccountVO;

/**
 * 海洋渔业增加值占主要海洋产业增加值比重评估指标计算类.
 */
public class FisheryIncreasetoGOPCalculateService extends IndicatorEvaluationCalculateService {

	private String BaseIndicatorName = ProvinceIndicatorConstant.MAJOR_MARINE_ADDVALUE_NAME;
	private String FisheryIndicatorName = ProvinceIndicatorConstant.FISHERY_ADDVALUE_NAME;

	@Override
	protected Double calculate(IndicatorEvaluation indicator, IndicatorAccountVO indicatorAccountVO) {
		Double currentBase = getInputOrAccountingIndicatorValue(indicatorAccountVO, indicatorAccountVO.getYear(),
				BaseIndicatorName);
		Validate.isTrue(currentBase != null);
		Double currentParent = getInputOrAccountingIndicatorValue(indicatorAccountVO, indicatorAccountVO.getYear(),
				FisheryIndicatorName);
		Validate.isTrue(currentParent != null);

		return (currentParent / currentBase) * 100;
	}

}
